home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d13
/
qptech.arc
/
TI372.ASC
< prev
next >
Wrap
Text File
|
1991-04-25
|
3KB
|
133 lines
PRODUCT : QUATTRO PRO NUMBER : 372
VERSION : ALL
OS : DOS
DATE : April 18, 1991 PAGE : 1/2
TITLE : INCREMENTING DATES BY MONTH
To enter dates that calculate for the varying number of days in a
month taking into consideration leap years, you need to use the
following procedure:
1. In the first cell, enter the beginning date using Ctrl-D.
Format the cell to display the date as you desire using
/Style | Numeric Format | Date. If the cell display
changes to *'s, you will need to widen the column using
/Style | Column Width. For this example, cell A1 is used
as the first cell.
2. In the cell directly below the first cell (eg. A2), enter
the following formula:
+A1+@CHOOSE(@MONTH(A1)-1,31,@IF(@MOD(@YEAR(A1),4)=0
#AND#@MOD(@YEAR(A1),100)<>0#OR#@MOD(@YEAR(A1),400)=0,29,28)
,31,30,31,30,31,31,30,31,30,31)
This formula should be entered in its entirety in the
second cell (eg. A2). Do not split the formula.
3. Copy this formula to the rest of the cells in the column
using /Edit | Copy.
4. Format the cells to the display format you want using
/Style | Numeric Format | Date.
This example details how to enter the dates in a column. The
same formula would work across the row as well.
This procedure will work for any day of the month between 1 and
28. You will need to edit some of the formulas if you need to
use days between 29 and 31.
The logic behind this formula is as follows:
+A1+@CHOOSE(@MONTH(A1)-1,31,
... ,31,30,31,30,31,31,30,31,30,31)
calculates the month of the previous entry (eg. A1) and
adds the number of days in the current month to the
previous entry. The @CHOOSE command calculates the
PRODUCT : QUATTRO PRO NUMBER : 372
VERSION : ALL
OS : DOS
DATE : April 18, 1991 PAGE : 2/2
TITLE : INCREMENTING DATES BY MONTH
number of days to add from the list based on the results
of the @IF function.
@IF(@MOD(@YEAR(A1),4)=0 #AND# @MOD(@YEAR(A1),100)<>0
#OR# @MOD(@YEAR(A1),400)=0,29,28)
determines whether the year is a leap year by testing for
the following three conditions:
1. All leap years are evenly divisible by 4.
2. All years divisible by 100 are not necessarily
leap years.
3. All years evenly divisible by 400 are leap years.
If the year is a leap year, the formula adds 29 days to the month
of February. If not, it adds only 28.